(function () {
  // 步骤3：创建echarts实例
  let myChart = echarts.init(document.querySelector(".box-m1"));
  // 步骤4：定义配置（指定图表的配置项和数据）


  let option = {
    title: {
      text: '现役球员排行',
      right:"center"
    },
    tooltip: {
      trigger: 'item',
      formatter: '{a} <br/>{b} : {c}%'
    },
    toolbox: {
      feature: {
        dataView: { readOnly: false },
        restore: {},
        saveAsImage: {}
      }
    },
    legend: {
      data: ['Show', 'Click', 'Visit', 'Inquiry', 'Order']
    },
    series: [
      {
        name: 'Funnel',
        type: 'funnel',
        left: '10%',
        top: 20,
        bottom: 20,
        width: '80%',
        min: 0,
        max: 100,
        minSize: '0%',
        maxSize: '100%',
        sort: 'descending',
        gap: 2,
        label: {
          show: true,
          position: 'inside'
        },
        labelLine: {
          length: 10,
          lineStyle: {
            width: 1,
            type: 'solid'
          }
        },
        itemStyle: {
          borderColor: '#fff',
          borderWidth: 1
        },
        emphasis: {
          label: {
            fontSize: 20
          }
        },
        data: [
          { value: 60, name: '利拉德，东契奇，塔图姆，欧文'  },
          { value: 40, name: '约基奇，乔治，德罗赞' },
          { value: 20, name: '特雷杨，哈登，拉文' },
          { value: 80, name: '字母哥,恩比德,巴特勒，戴维斯' },
          { value: 100, name: '詹姆斯,杜兰特,库里,伦纳德' }
        ]
      }
    ],

  };


  // 步骤5：使用刚指定的配置项和数据显示图表
  myChart.setOption(option);

  // window.onresize = () => {
  //     myChart.resize()
  // }

  window.addEventListener("resize", () => {
    myChart.resize();
  });
})();
